
#include "PipelineContexts.h"
#include "Common/Errors.h"

using namespace std;
using namespace ttg::services;
using namespace ttg_internal;
using namespace ttg_internal::pipeline;

//-----------------------
//--- InternalContext ---
//-----------------------

InternalContext::InternalContext()
{
	this->node_enumeration = NULL;
	this->root_context_id = context_id_manager.createContextID();
	this->sub_pipelines = NULL;
}

std::vector<NavigatorNode *> &InternalContext::getPipelineEnumeration()
{
#ifdef TTG_DEBUG
	if (node_enumeration == NULL)
		throw ttg::Error(ttg::Error::FATAL, "InternalContext", "getPipelineEnumeration",
						 "Internal error: node enumeration was not assigned");
#endif
	return *node_enumeration;
}

ISubPipeline *InternalContext::getSubPipeline(const char *name)
{
#ifdef TTG_DEBUG
	if (sub_pipelines == NULL)
		throw ttg::Error(ttg::Error::FATAL, "InternalContext", "getSubPipeline",
						 "SubPipelines was not assigned");
#endif
	return sub_pipelines->get(name);
}
